<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddIndexToSourceErrRecords extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    protected $table = "source_err_records";
    public function up()
    {
        Schema::table($this->table, function (Blueprint $table) {
            $table->index('err_msg','err_msg');
            $table->index('err_type','err_type');
            $table->index('phone_num','phone_num');
            $table->index('source','source');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if(Schema::hasTable($this->table)){
            Schema::table($this->table, function (Blueprint $table) {
                $table->dropIndex('err_msg');
                $table->dropIndex('err_type');
                $table->dropIndex('phone_num');
                $table->dropIndex('source');
            });
        }
    }
}
